#############################################################################
#     Make file for the FSP suite of programs.
#############################################################################
# Use "make install" to install binaries.
# Use "make de-install" to remove installed binaries and man pages.
# Use "make install-merge" to install the client merge and symbolic links.
# Use "make install-man" to install the man pages.
# 

#############################################################################
# The following variable defines the compiler to use in your compilation.
#
CC	= @CC@

#############################################################################
# Set up your compiler flags here.  If you want optimized code, leave it
# the way it is now.
#
OPTIM	= -O

#############################################################################
# If you need to link in any additional libraries, do it here.
# AT&T 3B2/600G + AT&T Unix Sys V R 3.2.3 + WIN/TCP R 3.2 use -lnet -lnsl_s 
# Sequent Dynix/ptx, use -lsocket -linet -lnsl -lseq
#
EX_LIBS	= @EX_LIBS@

#############################################################################
# define this to '&' if you plan to use parallel make. You need
# the enhanced GNU make or Sequent's make for that
#
PARALLEL_MAKE = @PARALLEL_MAKE@


#############################################################################
# NOTE: YOU SHOULD NOT HAVE TO CHANGE ANYTHING BELOW THIS LINE
#############################################################################

prefix	= /usr/local

BIN	= ${prefix}/bin
MAN	= ${prefix}/man

INCLUDE	= -I../include

DEFS	= @DEFS@

CFLAGS	= ${OPTIM} ${INCLUDE} ${DEFS}

SHELL	= /bin/sh

AR	= ar
ARFLAGS	= cru
RM	= rm

INSTALL	= @INSTALL@
DINSTAL	= @INSTALL_DATA@
LN	= @LN_S@
RANLIB	= @RANLIB@

PROG_FL	= AR="${AR}" CC="${CC}" CFLAGS="${CFLAGS}" SHELL="${SHELL}" \
	  INSTALL="${INSTALL}" DINSTAL="${DINSTAL}" LN="${LN}" \
	  RANLIB="${RANLIB}" BIN="${BIN}" MAN="${MAN}" EX_LIBS="${EX_LIBS}" \
	  RM="${RM}" PARALLEL_MAKE="${PARALLEL_MAKE}" ARFLAGS="${ARFLAGS}"

all: fspserver fspclients

bsd_dir:
	@(cd bsd_src; make all ${PROG_FL})

common_dir:
	@(cd common;  make all ${PROG_FL})

client_dir:
	@(cd client;  make all ${PROG_FL})

fspserver: bsd_dir common_dir
	@(cd server;  make all ${PROG_FL})

fspclients: bsd_dir common_dir client_dir
	@(cd clients; make all ${PROG_FL})

merge: bsd_dir common_dir client_dir
	@(cd clients; make fspmerge ${PROG_FL})

install:  fspserver fspclients
	@(cd server; make install ${PROG_FL})
	@(cd clients; make install ${PROG_FL})

install-merge: fspserver merge
	@(cd server; make install ${PROG_FL})
	@(cd clients; make install_merge ${PROG_FL})

install-man:
	@(cd man; make install ${PROG_FL})

clean:
	@(cd server; make clean ${PROG_FL})
	@(cd clients; make clean ${PROG_FL})
	@(cd bsd_src; make clean ${PROG_FL})
	@(cd common; make clean ${PROG_FL})
	@(cd client; make clean ${PROG_FL})

de-install:
	@(cd server; make de-install ${PROG_FL})
	@(cd clients; make de-install ${PROG_FL})
	@(cd man; make de-install ${PROG_FL})

